package com.test.io.propertiesDemo;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @version 1.0
 * @Author: 许啸林 使用FileRead 模拟读取properties配置文件
 * @Date: 2021/6/4 15:45
 */
public class myReadDemo {
    @Test
    public void readp() {
        BufferedReader bufferedReader = null;
        try {
            bufferedReader = new BufferedReader(new FileReader("src\\my.properties"));
            String str = "";
            while ((str = bufferedReader.readLine()) != null) {
                String[] param = str.split("=");
                System.out.println(param[0] + " = " + param[1]);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if(bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
